﻿/**
*诉讼申请
*/
Chenxin.UI.ApplyLitigationForm = Chenxin.extend(Chenxin.UI.FormCommon, {
    actionUrl: '/service/logic/ShowListLitigation.ashx',
    id: 'AppLit',
    renderTo: 'divAppLit',
    title: '诉讼申请',
    jqmWidth: 450,
    defBBtn:true,
    createForm: function() {
        return Chenxin.FormCommon.ApplyLitigationForm(this.id);
    },
	initFormValidator:function(){
	    //物业地址
        $("#"+this.id+"_HouseAddress").formValidator({
            validatorgroup: this.id,
            onshow: "请输入物业地址！",
            onfocus: "物业地址为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "物业地址不能为空！"
            },
            onerror: "物业地址不能为空！"
        });
	    //涉诉金额
        $("#"+this.id+"_LitigationMoney").formValidator({
            validatorgroup: this.id,
            onshow: "",
            onfocus: "格式错误",
            oncorrect: " "
        }).regexValidator({
            regexp:"decmal8",
            datatype:"enum",
            onerror:"格式错误"
        });
        //诉讼时间
        $("#"+this.id+"_AppDate").formValidator({
            validatorgroup: this.id,
            onshow: "请输入诉讼时间！",
            onfocus: "诉讼时间为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "诉讼时间不能为空！"
            },
            onerror: "诉讼时间不能为空！"
        });
        //诉讼对象
        $("#"+this.id+"_LitigationPerson").formValidator({
            validatorgroup: this.id,
            onshow: "请输入诉讼对象！",
            onfocus: "诉讼对象为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "诉讼对象不能为空！"
            },
            onerror: "诉讼对象不能为空！"
        });
    },
    initEvent: function() {
        var _this = this;
        
		//涉诉金额输入控制
	    $("input[name='LitigationMoney']").keydown(function (event) {
            if (((event.keyCode > 47) && (event.keyCode < 58)) || 
                  ((event.keyCode > 95) && (event.keyCode < 106)) ||
                  (event.keyCode == 110) || (event.keyCode == 8) ||   
                  (event.keyCode == 190)) {
                return true;      
            } else {      
                return false;      
            }      
        });
        $("#"+this.id+"_AppDate").focus(function(){
            WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})
        });
    },
    createComboList:function(){
        //提交部门
        var comboAppDepartId = new Chenxin.UI.DepartTreeCombo({
			containerId: '#AppDepartId',
            textBoxId: 'AppDepartId',
            name: 'AppDepartId',
            inModelType: 'all',
            txtModelName: 'AppDepart',
            required: true,
            afterSetValue: function(val, txt) {
            },
            onSelected: function() {
            }
		});
		
        return [comboAppDepartId];
    },
    saveSucc: function() {
        this.reloadGrid();
    },
    initComponent: function() {
        Chenxin.UI.ApplyLitigationForm.superclass.initComponent.call(this);
    }
});

Chenxin.FormCommon.ApplyLitigationForm=function(formID){
	return '<table class="tbl_f"><tr><th style="width:105px; height:26px;">成交编号：</th><td><input name="ContractCode" class="inputbox_n fl" type="text" readonly="readonly" style="width:150px;"/><input type="hidden" name="ContractId" /></td></tr><tr><th>物业地址：</th><td><input id="'+formID+'_HouseAddress" name="HouseAddress" class="inputbox_n fl" type="text" style="width:300px;"/></td></tr><tr><th>提交部门：</th><td><input type=text id="AppDepartId" class="inputbox_n fl" style="width:151px" /></td></tr><tr><th>诉讼时间：</th><td><input id="'+formID+'_AppDate" name="AppDate" class="inputbox_n fl" type="text" style="width:150px;" readonly="readonly"/></td></tr><tr><th>涉诉金额：</th><td><input id="'+formID+'_LitigationMoney" name="LitigationMoney" class="inputbox_n fl" type="text" maxlength="30" style="width:150px;ime-mode:disabled;"/>元</td></tr><tr><th>诉讼对象：</th><td><input id="'+formID+'_LitigationPerson" name="LitigationPerson" class="inputbox_n fl" type="text" style="width:150px;"/></td></tr><tr><td colspan="2" ><input type="hidden" name="RecordId" /></td></tr></table>';
};